<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网站管理后台</title>
    <link
            href="${pageContext.request.contextPath }/static/nifty/css/bootstrap.css"
            rel="stylesheet">
    <link
            href="${pageContext.request.contextPath }/static/nifty/css/nifty.css"
            rel="stylesheet">
    <link
            href="${pageContext.request.contextPath }/static/lib/font-awesome/css/font-awesome.css?v=4.3.0"
            rel="stylesheet">
    <link
            href="${pageContext.request.contextPath }/static/nifty/plugins/pace/pace.min.css"
            rel="stylesheet">
    <script
            src="${pageContext.request.contextPath }/static/nifty/plugins/pace/pace.min.js"></script>
    <script
            src="${pageContext.request.contextPath }/static/nifty/js/jquery-2.2.4.min.js"></script>
    <script
            src="${pageContext.request.contextPath }/static/nifty/js/bootstrap.min.js"></script>
    <script
            src="${pageContext.request.contextPath }/static/nifty/js/nifty.js"></script>
    <script
            src="${pageContext.request.contextPath }/static/lib/layui/layui.js"
            charset="utf-8"></script>
    <link
            href="${pageContext.request.contextPath }/static/nifty/plugins/magic-check/css/magic-check.min.css"
            rel="stylesheet">
    <link rel="stylesheet"
          href="${pageContext.request.contextPath }/static/lib/layui/css/layui.css?__v=1477903794767"
          media="all">
    <script src="http://static.geetest.com/static/tools/gt.js"></script>
</head>
<body>
<div id="container" class="cls-container">
    <div id="bg-overlay" class="bg-img"
         style="background-image: url(${pageContext.request.contextPath }/static/nifty/img/bg-img-3.jpg)"></div>
    <div class="cls-content">
        <div class="panel-body">
            <div class="mar-ver pad-btm">
                <h3 class="h4 mar-no">Account Login</h3>
                <p class="text-muted">Sign In to your account</p>
            </div>
            <form method="post"
                  action="">
                <div class="form-group">
                    <input type="text"
                           id="username" value="admin" class="form-control" name="username"
                           placeholder="username" autofocus>
                </div>
                <div class="form-group">
                    <input type="password" id="password" value="123"
                           class="form-control" name="password" placeholder="password">
                </div>

                <!-- <div class="form-group">
                    <p style="text-align: left; line-height: 28px">拖动完成验证</p>
                    <div class="captcha-wrap">
                        <div id="embed-captcha"></div>
                        <p style="text-align: left;line-height: 28px" id="wait" class="show">正在加载验证码......</p>
                    </div>
                </div> -->
                <div class="checkbox pad-btm text-left">
                    <input id="demo-form-checkbox" class="magic-checkbox remember_me"
                           type="checkbox"> <label for="demo-form-checkbox">Remember
                    me</label>
                </div>
                <button class="btn btn-primary btn-lg btn-block" id="embed-submit"
                        type="button">Sign In
                </button>
            </form>
        </div>
    </div>
</div>
<script
        src="${pageContext.request.contextPath }/static/js/common.js?__v=1477903794749" type="text/javascript"></script>
<script>
    $("#embed-submit").click(function (e) {

        var username = $("#username").val(),
            password = $("#password").val(),
            remember = $(".remember_me").is(':checked') ? 1 : 0;
        if (username == "" || password == "") {
            layer.msg('请输入用户名或密码');
            return false;
        }
        ajax("${pageContext.request.contextPath }/login", {
                username: username,
                password: password,
                remember: remember
            }, function (data) {
                if (data.status) {
                    layer.msg(data.info);
                    setTimeout(function () {
                        window.location.href = '${pageContext.request.contextPath }' + data.url;
                    }, 1000)
                    parent.layer.close();
                } else {
                    layer.msg(data.info);
                }
            }
        );
    })
</script>
</body>
</html>

